package com.itwn.service;

import com.itwn.entity.User;
import com.itwn.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService{
    @Autowired
    UserMapper um;
    @Override
    public List<User> queryAll() {
        List<User> users = um.SelAll();
        return users;
    }

    @Override
    public User queryByNameAndPass(String name, String pass) {
        User user = um.selUserByNameAndPass(name, pass);
        return user;
    }

    @Override
    public void updateUser(User user) {
        um.updateByPrimaryKey(user);
    }

    @Override
    public void delUserById(Integer id) {
        um.deleteByPrimaryKey(id);
    }

    @Override
    public int addUser(User user) {
        int insert = um.insert(user);
        return insert;
    }
}
